import React from 'react'
import { useSelector, useDispatch} from 'react-redux'
const App = () => {
  // 获取仓库数据
  const state = useSelector(state => state);
  const dispatch = useDispatch();
  const handleAdd = (num) => {
    dispatch({ type: 'addCount', payload: num })
  }
  return (
    <div>
      <h1>仓库：  {state.count}</h1>
      <button onClick={() => handleAdd(1)}>+1</button>
      <button onClick={() => handleAdd(10)}>+10</button>
    </div>
  )
}

export default App